<%--
  Created by IntelliJ IDEA.
  User: 润
  Date: 2021/7/26
  Time: 19:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#insert").click(function () {
            var name=document.getElementById("add").value;
            var cid=document.getElementById("hidden").value;
            if(name==""){
                alert("输入内容不能为空！");
            }else {
                $.ajax({
                    type: "POST",
                    url: "http://localhost:8080/Anyview/ManagerServlet?action=updateCollege",
                    data: {"name": name,"cid":cid},
                    success: function (data) {
                        if (data.result1) {
                            alert("修改成功！");
                            window.location.href = "http://localhost:8080/Anyview/ManagerServlet?action=queryAllCollege";
                        }
                    },
                    dataType: "json"
                })


            } })

    })
</script>
<body>


<div align="center">
        <form >
            学院名称:<input type="text" id="add" value="${requestScope.college.name}"><br><br>
            <input type="hidden" id="hidden" value="${requestScope.college.id}">
            <input type="button" id="insert" value="确定">
        </form>

</div>


</body>
</html>
